public class Text2 {
    public int maximumScore(int[] nums, int k) {
        int i = 0;
        int j = 0;
        int count = 0;
        int min = 0;
        while(j < nums.length) {
            if(nums[j] < 2) {
                i++;
                j++;
            }else {
                if(count == 0) {
                    count++;
                    min = nums[j];
                }else if(min > nums[j]) {
                    min = nums[j];
                }
                if(nums[i] < 2) {
                    return min * (j -i  + 1);
                }else {
                    j++;
                }
            }
        }
        return min * (j -i  + 1);
    }
}
